/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Comparators;

import beans.GastosReceitas;
import net.sourceforge.floggy.persistence.Comparator;
import net.sourceforge.floggy.persistence.Persistable;

/**
 *
 * @author familia
 */
public class GastoReceitasNomeComparator implements Comparator {
    public int compare(Persistable o1, Persistable o2) {
        GastosReceitas gr1 = (GastosReceitas) o1;
        GastosReceitas gr2 = (GastosReceitas) o2;

        int result = gr1.getNome().compareTo(gr2.getNome());

        if (result == 0) {
            return EQUIVALENT;
        } else if (result > 0) {
            return FOLLOWS;
        } else {
            return PRECEDES;
        }
    }
}
